package com.gosophia.conference.action.scheme;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.conferenceManagement.scheme.dto.SchemeJobDataDTO;
import com.gosophia.conferenceManagement.scheme.ws.ConferenceSchemeWebService;

@SuppressWarnings("serial")
@Scope("prototype")
@Controller("GetSchemeEveryDetailAction")
public class GetSchemeEveryDetailAction extends BaseSupportAction {

	private Long jobId;

	private String onlinePath;

	private String onlineVersion;

	private String onlineIsEdit = "unEdit";

	private SchemeJobDataDTO schemeJobData;

	// 页面类型，用于表示详细页面页面类型，
	//审批类详细：approvalDetail，除了审批以外的详细：otherDetail
	private String pageType;

	@Autowired
	private ConferenceSchemeWebService conferenceSchemeWebService;

	@Override
	public String _execute() throws Exception {
		schemeJobData = conferenceSchemeWebService
				.findSchemeJobDataDTOByJobId(jobId);
		onlinePath = schemeJobData.getOnlineDocumentDTO().getDocumentPath();
		onlineVersion = schemeJobData.getOnlineDocumentDTO()
				.getDocumentVersion();
		if("finishedTypeApprovalDetail".equals(pageType)){//处理页面审批历史记录传的参数
			pageType = "approvalDetail";
		}else if ("方案审批".equals(schemeJobData.getJobDTO().getJobType())) {
			pageType = "approvalDetail";
		} else {
			pageType = "otherDetail";
		}
		return SUCCESS;
	}

	public void setJobId(Long jobId) {
		this.jobId = jobId;
	}

	public Long getJobId() {
		return jobId;
	}

	public void setSchemeJobData(SchemeJobDataDTO schemeJobData) {
		this.schemeJobData = schemeJobData;
	}

	public SchemeJobDataDTO getSchemeJobData() {
		return schemeJobData;
	}

	public void setOnlinePath(String onlinePath) {
		this.onlinePath = onlinePath;
	}

	public String getOnlinePath() {
		return onlinePath;
	}

	public void setOnlineVersion(String onlineVersion) {
		this.onlineVersion = onlineVersion;
	}

	public String getOnlineVersion() {
		return onlineVersion;
	}

	public void setOnlineIsEdit(String onlineIsEdit) {
		this.onlineIsEdit = onlineIsEdit;
	}

	public String getOnlineIsEdit() {
		return onlineIsEdit;
	}

	public void setPageType(String pageType) {
		this.pageType = pageType;
	}

	public String getPageType() {
		return pageType;
	}

}
